﻿using System;

namespace AEM.Data.BLL.Actions
{
    public static class DefinedInfo
    {
        static DefinedInfo()
        {
            ModifyDefined = doModifyDefined;
        }

        private static bool doModifyDefined(string[] args)
        {
            if (args.Length < 4) return false;
            Model.ClientConfig model = DAL.ClientConfig.Search();
            if (null != model)
            {
                model.ElevatorInput = args[0];
                model.ElevatorOutput = args[1];
                model.EscalatorInput = args[2];
                model.WalkwayInput = args[3];
                DAL.ClientConfig.Update(model);
            }
            else
            {
                model = new Model.ClientConfig();
                model.ElevatorInput = args[0];
                model.ElevatorOutput = args[1];
                model.EscalatorInput = args[2];
                model.WalkwayInput = args[3];
                DAL.ClientConfig.Add(model);
            }
            return true;
        }

        /// <summary>
        /// 修改自定义信息输入/出 配置
        /// 第一个参数:长度4 [0]:ElevatorInput;[1]:ElevatorOutput;[2]:EscalatorInput;[3]:WalkwayInput
        /// </summary>
        public static Func<string[], bool> ModifyDefined;
    }
}
